<?php
/**
 * Prado Portal.
 *
 * @author Steen Rabol <steen.rabol@gmail.com>
 * @link http://www.pradoportal.dk/
 * @copyright Copyright &copy; 2006,2007,2008 Steen Rabol
 * @license http://www.pradoportal.dk
 * @version $Id: FixPageProp.php 377 2010-09-10 08:14:28Z steen.rabol $
 *
 */

Prado::using('Application.Common.Data.PortalPageRecord');

class UnlockPages extends PortalAdminPage
{
	public static function ToolMenuName()
	{
		return Prado::localize('Unlock pages');
	}

	public function onLoad($param)
	{
		parent::onLoad($param);
		$fixed	= array();
		$this->setAdminPageTitle('Unlock pages');
		$records = PortalPageRecord::finder()->findAllBylocked(1);
		PortalUtil::Info($records);
		if($records)
		{
			foreach($records as $record)
			{
				$record->locked	= 0;
				$record->save();
				$fixed[] = array('name' => Prado::localize("Page {0} unlocked", array($record->name)));
			}
		}

		if(count($fixed) != 0)
		{
			$this->Repeater->DataSource	= $fixed;
			$this->Repeater->dataBind();
			$this->ltNoFix->Visible	= false;
			$this->ltNoFix->Enabled	= false;
		}
		else
		{
			$this->Repeater->Visible	= false;
			$this->Repeater->Enabled	= false;
			$this->ltNoFix->Visible		= true;
			$this->ltNoFix->Enabled		= true;
		}
	}
}
?>
